Skip to content

crypto: make cgo Ecrevoer not escape sig in place like precompile ecrecover#33569

Closed
cuiweixie wants to merge 1 commit into
ethereum:masterfrom
cuiweixie:cgo_noescape
Closed

crypto: make cgo Ecrevoer not escape sig in place like precompile ecrecover#33569
cuiweixie wants to merge 1 commit into
ethereum:masterfrom
cuiweixie:cgo_noescape

Conversation

@cuiweixie
Copy link
Copy Markdown
Contributor

@cuiweixie cuiweixie commented Jan 9, 2026

test with cgo:

goos: darwin
goarch: arm64
pkg: github.com/ethereum/go-ethereum/core/vm
cpu: Apple M4 Pro
                                  │   old.txt   │            new.txt            │
                                  │   sec/op    │   sec/op     vs base          │
PrecompiledEcrecover/-Gas=3000-14   15.02µ ± 7%   15.07µ ± 2%  ~ (p=0.853 n=10)

                                  │   old.txt   │             new.txt             │
                                  │   gas/op    │   gas/op     vs base            │
PrecompiledEcrecover/-Gas=3000-14   3.000k ± 0%   3.000k ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

                                  │  old.txt   │           new.txt            │
                                  │   mgas/s   │   mgas/s    vs base          │
PrecompiledEcrecover/-Gas=3000-14   199.8 ± 6%   199.1 ± 2%  ~ (p=0.838 n=10)

                                  │  old.txt   │              new.txt               │
                                  │    B/op    │    B/op     vs base                │
PrecompiledEcrecover/-Gas=3000-14   352.0 ± 0%   272.0 ± 0%  -22.73% (p=0.000 n=10)

                                  │  old.txt   │              new.txt               │
                                  │ allocs/op  │ allocs/op   vs base                │
PrecompiledEcrecover/-Gas=3000-14   6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)

@cuiweixie cuiweixie changed the title crypto: make cgo Ecrevoer not escape sig in place like precompile ecr… crypto: make cgo Ecrevoer not escape sig in place like precompile ecrecover Jan 9, 2026
@fjl
Copy link
Copy Markdown
Contributor

fjl commented May 12, 2026

Similar to #33537, I think we don't need to apply this because

  • ecrecover is not bottleneck
  • the compiler should be smart enough to figure it out. I don't like applying tricks that depend on deep compiler behavior.

@fjl fjl closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants